﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media.Imaging;

namespace ClimateControl.Controls.Converters
{
    public class BooleanToStringConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            string text = null;

            if (!(value is bool))
                return text;

            string param = parameter as string;
            if (string.IsNullOrEmpty(param))
                return text;

            string[] paramArray = param.Split('|');
            if (paramArray.Length != 2)
                return text;

            text = paramArray[(bool)value ? 0 : 1];

            return text;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
 	        throw new NotImplementedException();
        }
    }
}
